﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="MyVocationSpace.Login" %>

<%@ Register Src="Header.ascx" TagName="header" TagPrefix="uc" %>
<%@ Register Src="Footer.ascx" TagName="footer" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>..:: MY VocationSpace ::..</title>
    <link href="css/Default.css" rel="stylesheet" type="text/css" />
    <link href="css/MyStyle.css" rel="stylesheet" type="text/css" />
    <link href="css/Popup.css" rel="stylesheet" type="text/css" />
    <link href="css/NewStyle.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function sendPassword() {
            var txtEmail = document.getElementById("txtEmailAdd").value;
            if (txtEmail != "") {
                if (validate(txtEmail)) {
                    var xmlhttp;
                    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp = new XMLHttpRequest();
                    }
                    else {// code for IE6, IE5
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

                    }
                    xmlhttp.onreadystatechange = function () {
                        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

                            document.getElementById("loading").style.display = "none";
                            document.getElementById("ErrorDiv").style.display = "block";
                            document.getElementById("ErrorDiv").innerHTML = xmlhttp.responseText;
                            document.getElementById("txtEmailAdd").value = "";
                        }
                    }
                    xmlhttp.open("POST", "AJAX/SendPassword.aspx?EmailID=" + txtEmail + "&type=0", true);
                    xmlhttp.send();
                    document.getElementById("loading").style.display = "block";
                }
                else {
                    //                    document.getElementById("div7").innerHTML = "Please enter valid Email ID.";
                    //                    toggleDiv('div7', 1);
                    //                    return false;
                    //                    document.getElementById("ErrorDiv").style.display = "block";
                    //                    document.getElementById("ErrorDiv").innerHTML = "Please enter valid Email ID.";
                    document.getElementById("div7").innerHTML = "Invalid Email ID.";
                    toggleDiv('div7', 1);
                    return false;
                }

            }
            else {
                //                document.getElementById("ErrorDiv").style.display = "block";
                //                document.getElementById("ErrorDiv").innerHTML = "Please enter valid Email ID.";
                //                toggleDiv('div7', 1);
                //                return false;
                document.getElementById("div7").innerHTML = "Invalid Email ID.";
                toggleDiv('div7', 1);
                return false;
            }
        }
        function clearOnFocus() {
            document.getElementById("idSpanMsg").style.display = "none";
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div>
            <uc:header ID="header" runat="server" />
        </div>
        <div id="content-wrapper">
            <center>
                <div class="Content">
                    <div style="width: 700px; height: 350px; padding-top: 40px;">
                        <table cellpadding="0">
                            <tr>
                                <td align="center" style="width: 450px; padding:0px;">
                                    <span id="idSpanMsg" runat="server" class="spanErrorMsgs" style="display: none; width: 450px">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdBorder">
                                    <table cellpadding="5">
                                        <tr>
                                            <td class="heading" style="width: 450px; padding: 5px;" colspan="2">
                                                Login
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" class="lblName">
                                                Email address:
                                            </td>
                                            <td align="left">
                                                <div>
                                                    <asp:TextBox ID="txtEmail" Width="150px" runat="server"></asp:TextBox></div>
                                                <div style="padding-top: 5px">
                                                    <asp:RequiredFieldValidator ID="rfvtxtEmail" ForeColor="Red" runat="server" Display="Dynamic"
                                                        ControlToValidate="txtEmail" ErrorMessage="Please enter Email"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revtxtEmail" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                        ControlToValidate="txtEmail" runat="server" ForeColor="Red" ErrorMessage="Please enter valid Email"></asp:RegularExpressionValidator>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" class="lblName">
                                                Password:
                                            </td>
                                            <td align="left">
                                                <div>
                                                    <asp:TextBox ID="txtPassword" TextMode="Password" Width="150px" runat="server"></asp:TextBox>
                                                    <span style="padding-left: 10px;"><a href="javascript:void(0)" id="lnkFofgetPswd"
                                                        style="font-size: 11px; font-weight: normal" runat="server" onclick="popup('PassPopup','blanket','0');return false;">
                                                        Forgot Password?</a></span>
                                                </div>
                                                <div style="padding-top: 5px;">
                                                    <asp:RequiredFieldValidator ID="rfvtxtPassword" Display="Dynamic" ForeColor="Red"
                                                        runat="server" ControlToValidate="txtPassword" ErrorMessage="Please enter Password"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revtxtPassword" Display="Dynamic" ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9@\$]{8,20})$"
                                                        ControlToValidate="txtPassword" runat="server" ForeColor="Red" ErrorMessage="Invalid Password"></asp:RegularExpressionValidator>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td align="left">
                                                <asp:Button ID="btnSubmit" CssClass="formBtnEdit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
                                                <span>or</span> <span>
                                                    <asp:LinkButton ID="lnkGoBack" PostBackUrl="~/Home.aspx" CausesValidation="false"
                                                        runat="server">Join MyVocationspace</asp:LinkButton></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </center>
        </div>
        <div style="clear: both">
        </div>
        <div>
            <uc1:footer runat="server" ID="footer"></uc1:footer>
        </div>
    </center>
    <center>
        <div name="light" runat="server" id="blanket" style="display: none;" class="blanket">
        </div>
        <div id="PassPopup" style="display: none;" class="Popup">
            <table cellpadding="5px" border="0">
                <tr>
                    <td align="left" colspan="4" style="padding: 0">
                        <table style="height: 100%">
                            <tr>
                                <td style="width: 480px" align="left">
                                    <span>Forgot Password</span>
                                </td>
                                <td style="width: 20px" align="center">
                                </td>
                                <td style="width: 5px">
                                </td>
                                <td style="width: 10px; white-space: nowrap; background-color: White;" align="right"
                                    valign="middle">
                                    <a href="javascript:void(0)" onclick="$('#PassPopup').fadeOut('slow');$('#blanket').fadeOut('slow');document.getElementById('txtEmailAdd').value='';document.getElementById('ErrorDiv').style.display='none';toggleDiv('div7', 0);"
                                        runat="server" id="lnkClose" style="color: white; border: 0">
                                        <img alt="" src="Images/blue-close-button.png" align="right" style="border: 0"
                                            title="Close" />
                                    </a>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <hr style="color: #CCCCB2" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="color: Black; font-size: 12px;font-weight:bold;" align="right">
                        Email ID:
                    </td>
                    <td align="left">
                        <span style="float: left; padding-right: 5px">
                            <input type="text" id="txtEmailAdd" maxlength="100" onfocus="toggleDiv('div7', 0);"
                                style="width: 180px" /></span><span style="float: left">
                                    <div id="div7" class="errorDiv">
                                    </div>
                                </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <div id="loading" style="display: none;padding-right: 70px">
                            <img src="Images/loading.gif" alt="" height="30px" width="30px" />Please wait...</div>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2" style="padding-right: 90px">
                        <input type="button" id="Button1" value="SUBMIT" onclick="sendPassword();" class="formBtnEdit" />
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2" style="width: 100%; padding-left: 60px">
                        <div id="ErrorDiv" class="validatorerrorDiv" style="display: none;">
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </center>
    </form>
</body>
</html>
